package com.chen.module.testproducerconsumer.testjava8;

/**
 * create by chen on 2020/4/24 11:04
 * Email:chenshaopeng90@hotmail.com
 */
public class TestJoin {

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("t start..................");
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("t end..................");
            }
        });

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("t1 start..................");
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("t1 end..................");
            }
        });
        t.start();
        t1.start();
        t.join();
        t1.join();

        System.out.println("main end..................");
    }
}
